import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import { getInfo, setInfo } from '@/utils/storage'

Vue.use(Vuex)

export default new Vuex.Store({
    namespaced: true,
    state() {
      return {
        // 个人权证相关
        userInfo: getInfo()
      }
    },
    getters: {

    },
    mutations: {
      // 所有mutations的第一个参数都是state
      setUserInfo (state, obj) {
        state.userInfo = obj
        setInfo(obj)
      }
    },
    actions: {

    },
    modules: {
      user
    }
})